<template>
  <div class="dict-manage">
    <div class="dict-type card">
      <DictType ref="dictTypeRef" @add-type="addType" @edit-type="editType" />
    </div>
    <div class="dict-data card">
      <DictData ref="dictDataRef" @update="refresh" @add-type="addType" @edit-type="editType" />
    </div>
    <DictTypeEdit ref="dictTypeEditRef" @update="refresh" />
  </div>
</template>

<script setup lang="ts" name="dictManage">
import DictType from "./components/DictType.vue";
import DictTypeEdit from "./components/DictTypeEdit.vue";
import DictData from "./components/DictData.vue";
import { ref } from "vue";

const dictTypeRef = ref();
const dictDataRef = ref();
const dictTypeEditRef = ref();

const refresh = () => {
  dictTypeRef.value.getDictTypeAll();
  dictDataRef.value.refreshData();
};

const addType = () => {
  dictTypeEditRef.value.openDialog();
};

const editType = (data: any) => {
  dictTypeEditRef.value.openDialog(data);
};
</script>

<style lang="scss" scoped>
@use "./index";
</style>
